<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html>
<head>
    <title>注册页面</title>
    <link href="css/style.css" rel="stylesheet" type="text/css"/>
    <script src="js/myJs.js"></script>

    <script>
        //验证提交表单
        function validatePost(){
            if (validateFiled($("userNumber"),"用户名") == true &&
                validateFiled($("name"),"姓名")==true &&
                validateFiled($("passWord"),"密码")==true &&
                validateFiled($("passWord1"),"确认密码")==true &&
                validateFiled($("phone"),"电话号码")==true &&
                validateFiled($("identification"),"身份证号")==true &&
                validateFiled($("passWord"),"验证码")==true ) {
                $("registerForm").submit();
            }
        }
    </script>
</head>
<body id="register">
    <form id="registerForm" action="UserServlet?action=register" method="post">
        <h3>高校疫情防控管理系统 用户注册</h3>-
        <label for="userNumber"><span>学号/工号：</span><input id="userNumber" name="userNumber" type="text" value="${user.userNumber}"/></label>
        <label for="name"><span>姓名：</span><input id="name" name="name" type="text" value="${user.name}"/></label>
        <label for="passWord"><span>密码：</span><input id="passWord" name="passWord" type="password"/></label>
        <label for="passWord1"><span>确认密码：</span><input id="passWord1" name="passWord1" type="password"/></label>
        <label for="sex">
            <span>性别：</span>
            <select id="sex" name="sex">
                <option value="男" selected="selected">男</option>
                <option value="女">女</option>
            </select>
        </label>
        <label for="phone"><span>电话号码：</span><input id="phone" name="phone" type="text" value="${user.phone}"/></label>
        <label for="identification"><span>身份证号：</span><input id="identification" name="identification" type="text" value="${user.identification}"/></label>
        <label for="classes">
            <span>班级：</span>
            <select id="classes" name="classes">
                <c:forEach items="${classes}" var="cl">
                    <option value="${cl.classId}">${cl.className}</option>
                </c:forEach>
            </select>
        </label>
        <label for="userRole">
            <span>身份：</span>
            <select id="userRole" name="userRole">
                <option value="学生" selected="selected">学生</option>
                <option value="教职工" >教职工</option>
            </select>
        </label>

        <label for="checkCode">
            <span>验证码：</span><input id="checkCode" name="checkCode" type="text" style="width: 100px;margin:0 0 0 70px;"/>
            <img id="checkCodeImg" src="CheckCodeServlet" onclick="change()"/>
        </label>
        <div id="button">
            <input id="registerButton" name="registerButton" type="button" class="bt" value="注册" onclick="validatePost()">
            <a href="login.jsp" target="_self">已有账户，前去登录</a>
        </div>
    </form>

</body>
</html>
